<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function(){
	var flag = true;
	$("#loginbtn").click(function(){
		var idnumber=$("#idnumber").val();
		var password=$("#password").val();
		if (idnumber=="")
		 {
		 	alert("用户名不能为空！");
		 	 flag = false;
		 }
		else if(password=="")
		 {
		 	alert("密码不能为空！");
		 	 flag = false;
		 }

	 	// window.location.href="../index.html";
		else{
	 	$.ajax
	 	({
            url: "login.mvc",
            async: false,
            type: "post",
            data: {
                "idnumber":idnumber,
                "password": password,
            },
            dataType: "json",
            //jsonp: "callBackParamName",
            //jsonpCallback: "callBackNameLoginlo",
            success: function (data) {
                alert(data.cause);
                console.log("成功");
                // window.location.href="../index.html";
            },
            error: function () {
                console.log("失败");
                alert("用户名密码验证失败")
            }
        });	

		}
   		 
  	});

});
</script>
<title>Insert title here</title>
</head>
<body>
<div data-role="page" id="loginhome" data-theme="f">
    <div data-role="header" data-position="fixed">
        <h1> 登录InStar物资</h1>
    </div>
    <div data-role="content" id="homeContent">
        <form id="login" data-role="fieldcontain" style="margin-left: 10px;margin-right: 10px">
            <input type="text" id="idnumber" name="idnumber" placeholder="请输入帐号"/>
            <input type="password" id="password" name="password" placeholder="请输入密码 "/>

            <button type="submit" class="ui-btn" id="loginbtn">
                    <span class="loginbtn">
                        登录
                    </span>
            </button>
        </form>
    </div>
</div>

</body>
</html>